package com.dingwen.treasure.business.controller;

import com.dingwen.treasure.base.controller.BaseViewController;
import com.dingwen.treasure.mybatisplus.service.JavaScriptService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

/**
 * 　JavaScriptController
 * 　@author dingwen
 * 　@date 2022/8/29
 */
@Api(tags = "JavaScriptAPI")
@RestController
@Slf4j
@RequestMapping("javascript")
public class JavaScriptController implements BaseViewController {
    @Resource
    private JavaScriptService javaScriptService;


    /**
     * 可以指定业务规则执行对应规则
     * @param params     参数个数
     * @param businessId 业务标识
     */
    @PostMapping("/{businessId}")
    @ApiOperation(value = "测试")
    public void test(@RequestBody Map<String,Object> params,@PathVariable("businessId") Long businessId) {
        javaScriptService.run(params,businessId);
    }
}
